<?php

//更新论坛图标
$f_bg_url = get_img_url($content);
$bg_url_cond = (empty($forum['auto_bg_url']) || empty($f_bg_url)) ? '' : ", background_url = '$f_bg_url'";
//更新论坛简介为帖子标题
$intro_cond = (empty($forum['auto_intro'])) ? '' : ", intro = '$title'";

//发帖公共代码
if (0 != $forum['ext']) {
	require_once('forum/forum_ext/ext_'.$forum['ext'].'/do_topic_add.php');
} 

$rs = dt_query("UPDATE forum SET topic_c = topic_c + 1, reply_c = reply_c + 1 $bg_url_cond $intro_cond WHERE id = $forum_id");
if (!$rs) die('更新数据失败！');

if (0 < dt_count('forum', "WHERE id = $forum_id AND today = ".date('Ymd', time()))) {
	$rs = dt_query("UPDATE forum SET today_reply_c = today_reply_c + 1 WHERE id = $forum_id");
} else {
	$rs = dt_query("UPDATE forum SET today = ".date('Ymd', time()).", today_reply_c = 1, today_up_c = 0 WHERE id = $forum_id");
}
if (!$rs) die('更新today_reply_c数据失败！');
